package xin.yangshuai.jvm01.optimize;

import java.io.IOException;

/**
 * Hello
 *
 * @author shuai
 * @date 2022/1/18
 */
public class Hello {

    // -XX:+DoEscapeAnalysis -XX:+EliminateAllocations

    public static void main(String[] args) {

        long start = System.currentTimeMillis();
        for (int i = 0; i < 10000000; i++) {
            info();
        }
        long end = System.currentTimeMillis();
        System.out.println("------------:" + (end - start));
        // 为了方便查看堆内存中对象个数，线程sleep

        try {
            System.in.read();
        } catch (IOException e) {
            e.printStackTrace();
        }
//        try {
//            Thread.sleep(100000);
//        } catch (InterruptedException e1) {
//            e1.printStackTrace();
//        }


    }

    public void f() {
        Object object = new Object();
        synchronized (object) {
            System.out.println(object);
        }

    }

    public static void info() {
        User user = new User();
        user.age = 20;
        user.name = "world";
    }


}

class User {
    int age;
    String name;
}

